// JavaScript Document

Cufon.replace('.title');

$(function(){
		   
		   var days = 03;
		   var month = 03;
		   var year = 2012;
		   var hours = 00;
		   var minutes = 01;
		   
		  $("#fliptimer").fliptimer({year:year,month:month,days:days,hours:hours,minutes:minutes});
		   
		   if($.browser.msie&&$.browser.version==7)
		   {
			   $("#tabs>div:first").show();
		   }
		   
		   var index = 0,temp='';
		   $("#tab-controls ul li a").click(function(event){
													 
													  if($(this).parent("li").index("#tab-controls ul li")==index)
													 return;
													 
													 index = $(this).parent("li").index("#tab-controls ul li");
													$("#tabs>div").fadeOut('fast');
													$("#tabs>div:eq("+index+")").fadeIn('fast');
													 
													   $("#tab-controls ul li").not($(this).parent("li")).removeClass("active-tab").addClass("default-tab");
													 $(this).parent("li").addClass("active-tab");
													 
													 event.preventDefault();
													 
													 });
		   
		   $("input[type=text],textarea").bind({
									  
									  focusin:function(){
										  
										  temp = $(this).val();
										  $(this).val('');
										  
										  
										  },
										focusout:function(){
										  
										  
										  if($(this).val()=='')
										  {
											$(this).val(temp);
										  }
										  
										  
										  }
									   
									  });
		   
		   
		   		var flag= false;					  
			$("#contact_submit").click(function(event){
										  flag= false;	
										 
											
										   $("#contact_form").find("input[type=text],textarea").each(function(){
											  if($(this).val()=="Name"||$(this).val()=="Email"||$(this).val()=="Message")
										   		{
												 $(this).css("border","1px solid  #94cbff");
												  flag = true;
										 		  }
										  		  else
										  		{
													 $(this).css("border","1px solid #dddddd");				
												   
												}
											});
											  if(flag==true)
										   {
											    event.preventDefault(); return;
										   }
										   
										   
										    $("#contact_submit").attr("value","Sending");
										    $.post("contact.php",{email:$("#email").val(),name:$("#name").val(),message:$("#msg").val(),choice:"contact"},function(data){ 
																																								   
                                                  if(data=="success")
												  $("#contact_submit").attr("value","Sent !");
												else
												  $("#contact_submit").attr("value","Not Sent !"); 
																																								   });
										   
										  
											   event.preventDefault();
											
											
										  
										 
										 
										   });	
	
	
	$("#in_submit").click(function(event){
										  
										   if($("#inform_email").val()=="Enter your email and stay tuned!")
										   {
											   
											   $("#inform_email").css("border","1px solid  #94cbff");
											   event.preventDefault();
											   return;
										   }
										   
										   $("#in_submit").attr("value","Wait");
										   $("#inform").css("right","10px");
										  $.post("contact.php",{email:$("#inform_email").val(),choice:"inform"},function(data){ 
																														 
																				  if(data=="success")
																				  $("#in_submit").attr("value","Sent !");
																				  else
																				  $("#in_submit").attr("value","Error!");
																														  
																														  });
										  
										  
										  
										    event.preventDefault();
										   });	
	
	
	$("#social li a").hover(function(){
								
								$(this).stop(true,true).animate({bottom:3},200);
								
								
								},function(){
									
									
									$(this).stop(true,true).animate({bottom:0},200);
									
									});
		   
		   
		   
		   });